export const respondJson = (connection, res, statusCode, object) => {
    connection.release();
    res.status(statusCode);
    res.json(object);
}

export const respondSendMessage = (connection, res, statusCode, object) => {
    connection.release();
    res.status(statusCode);
    res.send(object);
}

export const respondReqDataMalformation = (res) => {
    res.status(200);
    res.json({
        status: false,
        errinfo: 'req data format incorrect!'
    });
}

export const respondServerSQLError = (res) => {
    res.status(200);
    res.json({
        status: false,
        errinfo: 'server MySQL error!'
    });
}

export const respondServerQueryError = (connection, res) => {
    connection.release();
    res.status(200);
    res.json({
        status: false,
        errinfo: 'server query error!'
    });
}